package hot;

public class Num739 {
    public int[] dailyTemperatures(int[] temperatures) {
        int n = temperatures.length;
        int[] nextTem = new int[n];
        for(int i = 0; i < n; i++) {
            int j = i + 1;
            int temp = temperatures[i];
            while(j < n && temperatures[j] <= temp) j++;
            if(j < n) nextTem[i] = j - i;
        }
        return nextTem;
    }
}
